package nongchang.kuaijiecaifu.com.ncapp_android.ui.fragment;

import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import nongchang.kuaijiecaifu.com.ncapp_android.R;
import nongchang.kuaijiecaifu.com.ncapp_android.common.fragment.BaseFragment;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.good.Cheap;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.good.Laisee;
import nongchang.kuaijiecaifu.com.ncapp_android.ui.adapter.CheapListAdapter;
import nongchang.kuaijiecaifu.com.ncapp_android.ui.adapter.MyLaiseeListAdapter;
import nongchang.kuaijiecaifu.com.ncapp_android.ui.widget.LoadingLayout;

/**
 * Created by Administrator on 2016/3/11 0011.
 */
public class CheapFragment extends BaseFragment {
    @BindView(R.id.list)
    RecyclerView mListView;
    @BindView(R.id.refresh)
    SwipeRefreshLayout mRefresh;
    @BindView(R.id.loading)
    LoadingLayout mLoading;
private CheapListAdapter adapter;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_cheap, container, false);
        return view;
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        ButterKnife.bind(this, getView());
        adapter=new CheapListAdapter(getContext());
        mListView.setAdapter(adapter);
        load();
    }

    private void load() {
        List<Cheap> list = new ArrayList<>();
        for (int i = 0; i < 6; i++) {
            Cheap item = new Cheap();
            item.last_money=500;
            item.money = 100;
            item.time=1466755911;
            list.add(item);
        }
        adapter.update(list);
        mLoading.showContent();
    }
}
